package com.app.mall.controller;

import com.app.mall.bean.Result;
import com.app.mall.dto.CreateGoodsParam;
import com.app.mall.enums.ResultStatus;
import com.app.mall.dto.GetGoodsParam;
import com.app.mall.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description:
 * @Author: zengtaiyang
 * @Date: 2021/4/13 14:38
 * @Version: 1.0
 */
@RestController
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @PostMapping("/getList")
    public Result getList(@RequestBody GetGoodsParam param) {
        return new Result(ResultStatus.SUCCESS.getCode(), ResultStatus.SUCCESS.getMessage(), goodsService.getList(param));
    }

    @PostMapping("/insert")
    public Result insert(@RequestBody CreateGoodsParam param) {
        return new Result(ResultStatus.SUCCESS.getCode(), ResultStatus.SUCCESS.getMessage(), goodsService.insert(param));
    }

}
